package com.xiaomi.shwx.common.config;

import io.minio.MinioClient;
import lombok.Data;
import org.springframework.boot.context.properties.ConfigurationProperties;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

/**
 * @program: after-sales-maintenance
 * @description: Minio配置
 * @author: Yangziyin
 * @create: 2024-05-16 22:53
 **/
@Data
@Configuration
@ConfigurationProperties(prefix = "minio")
public class MinioConfig {
    /**
     * 服务器地址
     */
    private String endpoint;
    /**
     * 登录用户名
     */
    private String accessKey;
    /**
     * 登录密码
     */
    private String secretKey;
    /**
     * 存储图片的bucket名称
     */
    private String imageBucketName;
    /**
     * 存储视频的bucket名称
     */
    private String videoBucketName;

    @Bean
    public MinioClient minioClient() {
        return MinioClient.builder()
                .endpoint(endpoint)
                .credentials(accessKey, secretKey)
                .build();
    }
}
